Socket
Socket
Sign inDemoInstall

isutf8

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isutf8

Check if a Node.js Buffer or Uint8Array is UTF-8


Version published
Weekly downloads
103K
increased by14.16%
Maintainers
1
Weekly downloads
 
Created
Source

NPM Version NPM Downloads Bundlephobia install size

isutf8

Quick check if a Node.js Buffer or Uint8Array is valid UTF-8.

Advantages

  • Ultra-small package size
  • No dependencies
  • No pre-compilation

Install

npm install isutf8

Usage

CommonJS

const isUtf8 = require('isutf8');

const buf = Buffer.from([0xd0, 0x90]);
console.log(isUtf8(buf)); // => boolean

// or 

const arr = new Uint8Array([0xd0, 0x90]);
console.log(isUtf8(arr)); // => boolean

ES Modules or TypeScript

import isUtf8 from 'isutf8';

const buf = Buffer.from([0xd0, 0x90]);
console.log(isUtf8(buf)); // => boolean

// or 

const arr = new Uint8Array([0xd0, 0x90]);
console.log(isUtf8(arr)); // => boolean

License

MIT License

Keywords

FAQs

Package last updated on 27 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc